﻿using System;

namespace SharpSqlAnalyzer.pp.utils
{
	// Token: 0x020001F8 RID: 504
	internal class WhitespaceSourceTokenHelper
	{
		// Token: 0x060011A8 RID: 4520 RVA: 0x00315BC4 File Offset: 0x00313DC4
		public static TSourceToken createWhitespaceSourceToken(int length)
		{
			if (length == 0)
			{
				return null;
			}
			if (length <= 32)
			{
				return WhitespaceSourceTokenHelper.SourceTokenCache.cache[length - 1];
			}
			char[] array = new char[length];
			Utils.Fill<char>(array, 0, length, ' ');
			return new TSourceToken(new string(array))
			{
				tokentype = ETokenType.ttwhitespace
			};
		}

		// Token: 0x02000437 RID: 1079
		private class SourceTokenCache
		{
			// Token: 0x06002963 RID: 10595 RVA: 0x0033E3CC File Offset: 0x0033C5CC
			internal SourceTokenCache()
			{
			}

			// Token: 0x06002964 RID: 10596 RVA: 0x0033E3D4 File Offset: 0x0033C5D4
			static SourceTokenCache()
			{
				char[] array = new char[32];
				Utils.Fill<char>(array, 0, 32, ' ');
				for (int i = 0; i < WhitespaceSourceTokenHelper.SourceTokenCache.cache.Length; i++)
				{
					WhitespaceSourceTokenHelper.SourceTokenCache.cache[i] = new TSourceToken(new string(array, 0, i + 1));
					WhitespaceSourceTokenHelper.SourceTokenCache.cache[i].tokentype = ETokenType.ttwhitespace;
				}
			}

			// Token: 0x04001EC7 RID: 7879
			public const int COUNT = 32;

			// Token: 0x04001EC8 RID: 7880
			internal static readonly TSourceToken[] cache = new TSourceToken[32];
		}
	}
}
